<?php 
session_start();
if (isset($_POST['n']) && isset($_SESSION['openid'])){ 
	$name=trim(addslashes($_POST['n']));
	$lianxi=trim(addslashes($_POST['lx']));
	$shenfen=trim(addslashes($_POST['sf']));
	include_once("../c/config.php");
	$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
	if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
	$openid=$_SESSION['openid'];
	$query=$mysqli->query("select id from uinfo where openid='".$openid."' limit 0, 1");
	if($query->num_rows>0){
	    $mysqli->query("update uinfo set name='".$name."',lianxi='".$lianxi."',shenfen='".$shenfen."' where openid='".$openid."' "); 
	}else{
	    $mysqli->query("insert into uinfo(openid,name,lianxi,shenfen,createtime) values('".$openid."','".$name."','".$lianxi."','".$shenfen."','".date("Y-m-d H:i:s")."') ");
	}
	$mysqli->query("update play set ling1='yes' where openid='".$openid."' and jid='1'  "); 
	echo json_encode(array('status'=>'ok'));
}
?>